﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BT_DoHoa_Nhom13.ShapeLib.FCShapes
{
    public class FCOutputShape : MyDiagramShape
    {
        public const float PERCENT = 0.1f;
        public FCOutputShape()
        {
            // TODO: Complete member initialization
            lstShapes = new List<MyShape>();
            lstShapes.Add(new MyLine());
            lstShapes.Add(new MyLine());
            lstShapes.Add(new MyLine());
            lstShapes.Add(new MyLine());
            lstShapes.Add(new MyLine());
        }

        public override MyShape Clone()
        {
            return new FCOutputShape();
        }

        public override MyShape CloneByDiagramFactory(DiagramFactorys.MyDiagramFactory factory)
        {
            MyShape newShape = factory.GetOutputShape();
            newShape.Copy(this);
            return newShape;
        }

        public override void ResetChildPoint()
        {
            int top, left, width, height;
            this.SetConfig(out top,out left,out width,out  height);
            int distance = (int)(PERCENT * width);


            lstShapes[0].SetStartPoint(left,top);
            lstShapes[0].SetEndPoint(left + width, top);

            lstShapes[1].SetStartPoint(left, top);
            lstShapes[1].SetEndPoint(left, top + height);

            lstShapes[2].SetStartPoint(left, top + height);
            lstShapes[2].SetEndPoint(left + width - distance, top + height);

            lstShapes[3].SetStartPoint(left + width - distance, top + height);
            lstShapes[3].SetEndPoint(left + width, top + height - distance);

            lstShapes[4].SetStartPoint(left + width, top + height - distance);
            lstShapes[4].SetEndPoint(left + width, top);
        }

    }
}
